package com.goscom.app.deeset;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.ArrayList;

import com.goscom.app.database.DBAdapter;

import android.content.ContentValues;
import android.content.Context;
import android.os.AsyncTask;
import android.util.Log;
import android.util.PrintStreamPrinter;

public class CollectData extends AsyncTask<String, Integer, Boolean> {

	private Context mCtx;
	private String mStrMerId, mStrUsername;
	private DBAdapter mDB;
	private ArrayList<String> mAlstTitle, mAlstContent;

	public CollectData(Context ctx, String strUsername, String strMerId,
			DBAdapter mDB) {
		this.mCtx = ctx;
		this.mStrMerId = strMerId;
		this.mStrUsername = strUsername;
		this.mDB = mDB;
	}

	@Override
	protected Boolean doInBackground(String... params) {
		Log.i("Write file", "Start");
		StringBuffer strData = new StringBuffer();
		strData.append("INSERT INTO deesethr(");

		mAlstTitle = new ArrayList<String>();
		addArrayTitle();
		for (int i = 0; i < mAlstTitle.size() - 1; i++) {
			strData.append(mAlstTitle.get(i) + ", ");
		}
		strData.append(mAlstTitle.get(mAlstTitle.size() - 1) + ") VALUES ('");

		mAlstContent = new ArrayList<String>();
		for (int i = 0; i < mAlstTitle.size(); i++) {
			mAlstContent.add("");
		}
		addArrayContent();
		for (int i = 0; i < mAlstContent.size() - 1; i++) {
			strData.append(mAlstContent.get(i) + "', '");
		}
		strData.append(mAlstContent.get(mAlstContent.size() - 1) + "');");

		File fileData = new File("/mnt/sdcard/DCMI/" + mStrMerId
				+ "-merchandiser.txt");
		FileOutputStream fos;
		try {
			fos = new FileOutputStream(fileData);
			OutputStreamWriter osw = new OutputStreamWriter(fos);
			osw.write(strData.toString());
			osw.flush();
			osw.close();
			Log.i("Write file", "Done");
			return true;
		} catch (FileNotFoundException e) {
			Log.i("FileNotFoundException", e.getMessage());
		} catch (IOException e) {
			Log.i("IOException", e.getMessage());
		}
		return false;
	}

	private void addArrayTitle() {
		mAlstTitle.add(0, "FirstName");
		mAlstTitle.add(1, "MiddleName");
		mAlstTitle.add(2, "LastName");
		mAlstTitle.add(3, "Area");
		mAlstTitle.add(4, "AreaManagerName");
		mAlstTitle.add(5, "DateOfEmployement");

		mAlstTitle.add(6, "homeTelephoneNumber");
		mAlstTitle.add(7, "subjectToImmigrationControl");
		mAlstTitle.add(8, "emailAddress");
		mAlstTitle.add(9, "mobileNumber");
		mAlstTitle.add(10, "nationality");
		mAlstTitle.add(11, "dob");

		mAlstTitle.add(12, "houseNumber");
		mAlstTitle.add(13, "townCity");
		mAlstTitle.add(14, "county");
		mAlstTitle.add(15, "postCode");

		mAlstTitle.add(16, "licencepresent");
		mAlstTitle.add(17, "noofpoints");

		mAlstTitle.add(18, "refree1Name");
		mAlstTitle.add(19, "refree1Role");
		mAlstTitle.add(20, "refree1Tele");
		mAlstTitle.add(21, "refree1Address");

		mAlstTitle.add(22, "refree2Name");
		mAlstTitle.add(23, "refree2Role");
		mAlstTitle.add(24, "refree2Tele");
		mAlstTitle.add(25, "refree2Address");

		mAlstTitle.add(26, "personToContactInEmergency");

		mAlstTitle.add(27, "convicted");
		mAlstTitle.add(28, "detailsOfConviction");

		mAlstTitle.add(29, "Languages");
		mAlstTitle.add(30, "Qualifications");
		mAlstTitle.add(31, "Skills");
		mAlstTitle.add(32, "Hobbies");

		mAlstTitle.add(33, "visitorSignInAchieved");

		mAlstTitle.add(34, "deesetMobileAchieved");

		mAlstTitle.add(35, "achieved");
		mAlstTitle.add(36, "electronicTimeAchieved");

		mAlstTitle.add(37, "dressCodeAchieved");
		mAlstTitle.add(38, "hivisibilityAchieved");
		mAlstTitle.add(39, "storeFireAchieved");

		mAlstTitle.add(40, "manualHandling");

		mAlstTitle.add(41, "copyOfProof");
		mAlstTitle.add(42, "name");
		mAlstTitle.add(43, "role");
		mAlstTitle.add(44, "telephone");
		mAlstTitle.add(45, "address");
		mAlstTitle.add(46, "commencingDate");
		mAlstTitle.add(47, "payRate");
		mAlstTitle.add(48, "totalContractedHours");
		mAlstTitle.add(49, "totalNonContractedHours");
		mAlstTitle.add(50, "additionalStores");

		mAlstTitle.add(51, "storeAndRetailer");
		mAlstTitle.add(52, "Job_Skill");
		mAlstTitle.add(53, "mon");
		mAlstTitle.add(54, "tue");
		mAlstTitle.add(55, "wed");
		mAlstTitle.add(56, "thu");
		mAlstTitle.add(57, "fri");
		mAlstTitle.add(58, "sat");
		mAlstTitle.add(59, "sun");

		mAlstTitle.add(60, "storesNonContract");
		mAlstTitle.add(61, "jobSkillsNonContract");
		mAlstTitle.add(62, "monNonContract");
		mAlstTitle.add(63, "tueNonContract");
		mAlstTitle.add(64, "wedNonContract");
		mAlstTitle.add(65, "thuNonContract");
		mAlstTitle.add(66, "friNonContract");
		mAlstTitle.add(67, "satNonContract");
		mAlstTitle.add(68, "sunNonContract");

		mAlstTitle.add(69, "tlName");
		mAlstTitle.add(70, "tile");
		mAlstTitle.add(71, "nationalInsuranceNumber");
		mAlstTitle.add(72, "gender");
		mAlstTitle.add(73, "thisIsMyFirstJob");
		mAlstTitle.add(74, "thisIsNowMyOnlyJob");
		mAlstTitle.add(75, "ihavAnotherJob");
		mAlstTitle.add(76, "studentLoans");
		mAlstTitle.add(77, "dateEmployementStarted");
		mAlstTitle.add(78, "jobTitle");

		mAlstTitle.add(79, "deptBranch");

		mAlstTitle.add(80, "BackProblems");
		mAlstTitle.add(81, "UpperLimbDisorders");
		mAlstTitle.add(82, "AnySkinComplaints");
		mAlstTitle.add(83, "StressRelatedDisorder");
		mAlstTitle.add(84, "NumbnessTingling");
		mAlstTitle.add(85, "LungComplaints");
		mAlstTitle.add(86, "HeartCirculatorySystem");
		mAlstTitle.add(87, "AnyDigestiveTrouble");
		mAlstTitle.add(88, "AnyPsychologicalOrNervousComplaints");
		mAlstTitle.add(89, "GoutAnyKidneyOfBladderComplaint");

		mAlstTitle.add(90, "FailedAMedicalExamination");
		mAlstTitle.add(91, "RecommendedToConsultASpecialist");
		mAlstTitle.add(92, "BeenAbsentFromWork");
		mAlstTitle.add(93, "ConductedAClaim");

		mAlstTitle.add(94, "EarNoseOrThroatComplaints");
		mAlstTitle.add(95, "EyeProblem");
		mAlstTitle.add(96, "WearGlassesOrContactLenses");
		mAlstTitle.add(97, "EyesLastTested");
		mAlstTitle.add(98, "SufferFromAMedicalCondition");
		mAlstTitle.add(99, "RegularMedication");
		mAlstTitle.add(100, "AnyTreatmentFromYourDoctor");
		mAlstTitle.add(101, "AbsentWithSickness");
		mAlstTitle.add(102, "Disability");
		mAlstTitle.add(103, "Smoke");
		mAlstTitle.add(104, "DrinkAlcohol");
		mAlstTitle.add(105, "Allergies");
		mAlstTitle.add(106, "TakeRegularExercise");

		mAlstTitle.add(107, "WorkedInADustyJob");
		mAlstTitle.add(108, "WorkedInNoisyJob");
		mAlstTitle.add(109, "AdvisedForMedicalReasons");
		mAlstTitle.add(110, "WorkDeafness");
		mAlstTitle.add(111, "Asthma");
		mAlstTitle.add(112, "PreviouslyWorkedForDEESET");

		mAlstTitle.add(113, "NameACHolder");
		mAlstTitle.add(114, "AccountNumber");
		mAlstTitle.add(115, "SortCode");
		mAlstTitle.add(116, "BuildingSocietyRefNo");

		mAlstTitle.add(117, "AgreeToWorkMore48");

		mAlstTitle.add(118, "colleague1");
		mAlstTitle.add(119, "colleague2");
		mAlstTitle.add(120, "colleague3");
		mAlstTitle.add(121, "colleague4");
		mAlstTitle.add(122, "signature");
	}

	private void addArrayContent() {
		ContentValues content = mDB.queryDataByMerId("MERNAME", mStrMerId);
		mAlstContent.set(0, content.getAsString("forename"));
		mAlstContent.set(2, content.getAsString("surname"));
		mAlstContent.set(3, content.getAsString("area"));
		mAlstContent.set(4, content.getAsString("amname"));
		mAlstContent.set(5, content.getAsString("date"));
		mAlstContent.set(69, content.getAsString("tlname"));
		mAlstContent.set(70, content.getAsString("title"));
		mAlstContent.set(72, content.getAsString("gender"));

		content = mDB.queryDataByMerId("MER", mStrMerId);
		content = mDB.queryDataByMerId("PERINFO", mStrMerId);
		if (content.getAsString("userid") == null) {
			mAlstContent.set(6, content.getAsString("telnum"));
			mAlstContent.set(7, convertBoolean(content.getAsString("control")));
			mAlstContent.set(8, content.getAsString("email"));
			mAlstContent.set(9, content.getAsString("mobnum"));
			mAlstContent.set(10, content.getAsString("nation"));
			mAlstContent.set(11, content.getAsString("birth"));
			mAlstContent.set(71, content.getAsString("insur"));
			mAlstContent.set(73, convertBoolean(content.getAsString("ckcA")));
			mAlstContent.set(74, convertBoolean(content.getAsString("ckcB")));
			mAlstContent.set(75, convertBoolean(content.getAsString("ckcC")));
			mAlstContent.set(76, convertBoolean(content.getAsString("ckcD")));
			mAlstContent.set(77, content.getAsString("strdate"));
			mAlstContent.set(78, content.getAsString("jobtit"));
		}

		content = mDB.queryDataByMerId("MER", mStrMerId);
		content = mDB.queryDataByMerId("ADDRESS", mStrMerId);
		if (content.getAsString("userid") == null) {
			mAlstContent.set(12, content.getAsString("numstreet"));
			mAlstContent.set(13, content.getAsString("city"));
			mAlstContent.set(14, content.getAsString("county"));
			mAlstContent.set(15, content.getAsString("postcode"));
		}

		content = mDB.queryDataByMerId("MER", mStrMerId);
		content = mDB.queryDataByMerId("VEHICLE", mStrMerId);
		if (content.getAsString("userid") == null) {
			mAlstContent
					.set(16, convertBoolean(content.getAsString("licence")));
			mAlstContent.set(17, content.getAsString("pointlic"));
		}

		content = mDB.queryDataByMerId("MER", mStrMerId);
		content = mDB.queryDataByMerAddOther("REFEREE", mStrMerId, "referee1");
		if (content.getAsString("userid") == null) {
			mAlstContent.set(18, content.getAsString("name"));
			mAlstContent.set(19, content.getAsString("role"));
			mAlstContent.set(20, content.getAsString("telephone"));
			mAlstContent.set(21, content.getAsString("conadd"));
		}

		content = mDB.queryDataByMerId("MER", mStrMerId);
		content = mDB.queryDataByMerAddOther("REFEREE", mStrMerId, "referee2");
		if (content.getAsString("userid") == null) {
			mAlstContent.set(22, content.getAsString("name"));
			mAlstContent.set(23, content.getAsString("role"));
			mAlstContent.set(24, content.getAsString("telephone"));
			mAlstContent.set(25, content.getAsString("conadd"));
		}

		content = mDB.queryDataByMerId("MER", mStrMerId);
		content = mDB.queryDataByMerId("CONEMER", mStrMerId);
		if (content.getAsString("userid") == null) {
			mAlstContent.set(26, content.getAsString("addtelnum"));
		}

		content = mDB.queryDataByMerId("MER", mStrMerId);
		content = mDB.queryDataByMerId("REHABILITATION", mStrMerId);
		if (content.getAsString("userid") == null) {
			mAlstContent.set(27,
					convertBoolean(content.getAsString("convicted")));
			mAlstContent.set(28, content.getAsString("detail"));
		}

		content = mDB.queryDataByMerId("MER", mStrMerId);
		content = mDB.queryDataByMerId("ADDITIONAL", mStrMerId);
		if (content.getAsString("userid") == null) {
			mAlstContent.set(29, content.getAsString("languages"));
			mAlstContent.set(30, content.getAsString("qualifications"));
			mAlstContent.set(31, content.getAsString("skills"));
			mAlstContent.set(32, content.getAsString("hobbies"));
		}

		content = mDB.queryDataByMerId("MER", mStrMerId);
		content = mDB.queryDataByMerAddOther("STOREINDUCTION", mStrMerId,
				"storeinduction");
		if (content.getAsString("userid") == null) {
			mAlstContent.set(33,
					convertBoolean(content.getAsString("checkall")));
		}

		content = mDB.queryDataByMerId("MER", mStrMerId);
		content = mDB.queryDataByMerAddOther("STOREINDUCTION", mStrMerId,
				"deesetprocedure");
		if (content.getAsString("userid") == null) {
			mAlstContent.set(34,
					convertBoolean(content.getAsString("checkall")));
		}

		content = mDB.queryDataByMerId("MER", mStrMerId);
		content = mDB.queryDataByMerAddOther("STOREINDUCTION", mStrMerId,
				"otherdeeset");
		if (content.getAsString("userid") == null) {
			mAlstContent.set(35, convertBoolean(content.getAsString("check1")));
			mAlstContent.set(36,
					convertBoolean(content.getAsString("checkall")));
		}

		content = mDB.queryDataByMerId("MER", mStrMerId);
		content = mDB.queryDataByMerAddOther("STOREINDUCTION", mStrMerId,
				"healthandsafety");
		if (content.getAsString("userid") == null) {
			mAlstContent.set(37, convertBoolean(content.getAsString("check1")));
			mAlstContent.set(38, convertBoolean(content.getAsString("check2")));
			mAlstContent.set(39,
					convertBoolean(content.getAsString("checkall")));
		}

		content = mDB.queryDataByMerId("MER", mStrMerId);
		content = mDB.queryDataByMerAddOther("STOREINDUCTION", mStrMerId,
				"manual");
		if (content.getAsString("userid") == null) {
			mAlstContent.set(40,
					convertBoolean(content.getAsString("checkall")));
		}

		content = mDB.queryDataByMerId("MER", mStrMerId);
		content = mDB.queryDataByMerId("OFFERLETTER", mStrMerId);
		if (content.getAsString("userid") == null) {
			mAlstContent.set(46, content.getAsString("comdate"));
			mAlstContent.set(47, content.getAsString("pay"));
			mAlstContent.set(48, content.getAsString("contracted"));
			mAlstContent.set(49, content.getAsString("noncontracted"));
			mAlstContent.set(50, content.getAsString("addsto"));
			mAlstContent.set(117, convertBoolean(content.getAsString("agree")));
		}

		content = mDB.queryDataByMerId("MER", mStrMerId);
		ArrayList<ContentValues> arrlst = new ArrayList<ContentValues>();
		StringBuffer strContStorel = new StringBuffer();
		StringBuffer strContJobSkill = new StringBuffer();
		StringBuffer strContMon = new StringBuffer();
		StringBuffer strContTue = new StringBuffer();
		StringBuffer strContWed = new StringBuffer();
		StringBuffer strContThu = new StringBuffer();
		StringBuffer strContFri = new StringBuffer();
		StringBuffer strContSat = new StringBuffer();
		StringBuffer strContSun = new StringBuffer();
		arrlst = mDB.queryListByMerContracted("CONTRACTEDHOURS", mStrMerId,
				"contracted");
		for (int i = 0; i < arrlst.size(); i++) {
			content = arrlst.get(i);
			if (content.getAsString("userid") == null) {
				strContStorel.append(content.getAsString("storel") + ";-;");
				strContJobSkill.append(content.getAsString("jobskill") + ";-;");
				strContMon.append(content.getAsString("mon") + ";-;");
				strContTue.append(content.getAsString("tue") + ";-;");
				strContWed.append(content.getAsString("wed") + ";-;");
				strContThu.append(content.getAsString("thu") + ";-;");
				strContFri.append(content.getAsString("fri") + ";-;");
				strContSat.append(content.getAsString("sat") + ";-;");
				strContSun.append(content.getAsString("sun") + ";-;");
			}
		}
		if (content.getAsString("userid") == null) {
			mAlstContent.set(51, strContStorel.toString());
			mAlstContent.set(52, strContJobSkill.toString());
			mAlstContent.set(53, strContMon.toString());
			mAlstContent.set(54, strContTue.toString());
			mAlstContent.set(55, strContWed.toString());
			mAlstContent.set(56, strContThu.toString());
			mAlstContent.set(57, strContFri.toString());
			mAlstContent.set(58, strContSat.toString());
			mAlstContent.set(59, strContSun.toString());
		}

		content = mDB.queryDataByMerId("MER", mStrMerId);
		arrlst = new ArrayList<ContentValues>();
		strContStorel = new StringBuffer();
		strContJobSkill = new StringBuffer();
		strContMon = new StringBuffer();
		strContTue = new StringBuffer();
		strContWed = new StringBuffer();
		strContThu = new StringBuffer();
		strContFri = new StringBuffer();
		strContSat = new StringBuffer();
		strContSun = new StringBuffer();
		arrlst = mDB.queryListByMerContracted("CONTRACTEDHOURS", mStrMerId,
				"noncontracted");
		for (int i = 0; i < arrlst.size(); i++) {
			content = arrlst.get(i);
			if (content.getAsString("userid") == null) {
				strContStorel.append(content.getAsString("storel") + ";-;");
				strContJobSkill.append(content.getAsString("jobskill") + ";-;");
				strContMon.append(content.getAsString("mon") + ";-;");
				strContTue.append(content.getAsString("tue") + ";-;");
				strContWed.append(content.getAsString("wed") + ";-;");
				strContThu.append(content.getAsString("thu") + ";-;");
				strContFri.append(content.getAsString("fri") + ";-;");
				strContSat.append(content.getAsString("sat") + ";-;");
				strContSun.append(content.getAsString("sun") + ";-;");
			}
		}
		if (content.getAsString("userid") == null) {
			mAlstContent.set(60, strContStorel.toString());
			mAlstContent.set(61, strContJobSkill.toString());
			mAlstContent.set(62, strContMon.toString());
			mAlstContent.set(63, strContTue.toString());
			mAlstContent.set(64, strContWed.toString());
			mAlstContent.set(65, strContThu.toString());
			mAlstContent.set(66, strContFri.toString());
			mAlstContent.set(67, strContSat.toString());
			mAlstContent.set(68, strContSun.toString());
		}

		content = mDB.queryDataByMerId("MER", mStrMerId);
		content = mDB.queryDataByMerAddOther("MEDICALHISTORY", mStrMerId,
				"sectiona");
		if (content.getAsString("userid") == null) {
			mAlstContent.set(80, content.getAsString("ans1"));
			mAlstContent.set(81, content.getAsString("ans2"));
			mAlstContent.set(82, content.getAsString("ans3"));
			mAlstContent.set(83, content.getAsString("ans4"));
			mAlstContent.set(84, content.getAsString("ans5"));
			mAlstContent.set(85, content.getAsString("ans6"));
			mAlstContent.set(86, content.getAsString("ans7"));
			mAlstContent.set(87, content.getAsString("ans8"));
			mAlstContent.set(88, content.getAsString("ans9"));
			mAlstContent.set(89, content.getAsString("ans10"));
		} else {
			mAlstContent.set(80, "No");
			mAlstContent.set(81, "No");
			mAlstContent.set(82, "No");
			mAlstContent.set(83, "No");
			mAlstContent.set(84, "No");
			mAlstContent.set(85, "No");
			mAlstContent.set(86, "No");
			mAlstContent.set(87, "No");
			mAlstContent.set(88, "No");
			mAlstContent.set(89, "No");
		}

		content = mDB.queryDataByMerId("MER", mStrMerId);
		content = mDB.queryDataByMerAddOther("MEDICALHISTORY", mStrMerId,
				"sectionb");
		if (content.getAsString("userid") == null) {
			mAlstContent.set(90, content.getAsString("ans1"));
			mAlstContent.set(91, content.getAsString("ans2"));
			mAlstContent.set(92, content.getAsString("ans3"));
			mAlstContent.set(93, content.getAsString("ans4"));
		} else {
			mAlstContent.set(90, "No");
			mAlstContent.set(91, "No");
			mAlstContent.set(92, "No");
			mAlstContent.set(93, "No");
		}

		content = mDB.queryDataByMerId("MER", mStrMerId);
		content = mDB.queryDataByMerAddOther("MEDICALHISTORY", mStrMerId,
				"sectionc");
		if (content.getAsString("userid") == null) {
			mAlstContent.set(94, content.getAsString("ans1"));
			mAlstContent.set(95, content.getAsString("ans2"));
			mAlstContent.set(96, content.getAsString("ans3"));
			mAlstContent.set(97, content.getAsString("ans4"));
			mAlstContent.set(98, content.getAsString("ans5"));
			mAlstContent.set(99, content.getAsString("ans6"));
			mAlstContent.set(100, content.getAsString("ans7"));
			mAlstContent.set(101, content.getAsString("ans8"));
			mAlstContent.set(102, content.getAsString("ans9"));
			mAlstContent.set(103, content.getAsString("ans10"));
			mAlstContent.set(104, content.getAsString("ans11"));
			mAlstContent.set(105, content.getAsString("ans12"));
			mAlstContent.set(106, content.getAsString("ans13"));
		} else {
			mAlstContent.set(94, "No");
			mAlstContent.set(95, "No");
			mAlstContent.set(96, "No");
			mAlstContent.set(97, "No");
			mAlstContent.set(98, "No");
			mAlstContent.set(99, "No");
			mAlstContent.set(100, "No");
			mAlstContent.set(101, "No");
			mAlstContent.set(102, "No");
			mAlstContent.set(103, "No");
			mAlstContent.set(104, "No");
			mAlstContent.set(105, "No");
			mAlstContent.set(106, "No");
		}

		content = mDB.queryDataByMerId("MER", mStrMerId);
		content = mDB.queryDataByMerAddOther("MEDICALHISTORY", mStrMerId,
				"sectiond");
		if (content.getAsString("userid") == null) {
			mAlstContent.set(107, content.getAsString("ans1"));
			mAlstContent.set(108, content.getAsString("ans2"));
			mAlstContent.set(109, content.getAsString("ans3"));
			mAlstContent.set(110, content.getAsString("ans4"));
			mAlstContent.set(111, content.getAsString("ans5"));
			mAlstContent.set(112, content.getAsString("ans6"));
		} else {
			mAlstContent.set(107, "No");
			mAlstContent.set(108, "No");
			mAlstContent.set(109, "No");
			mAlstContent.set(110, "No");
			mAlstContent.set(111, "No");
			mAlstContent.set(112, "No");
		}

		content = mDB.queryDataByMerId("MER", mStrMerId);
		content = mDB.queryDataByMerId("BANKDETAILS", mStrMerId);
		if (content.getAsString("userid") == null) {
			mAlstContent.set(113, content.getAsString("nameacc"));
			mAlstContent.set(114, content.getAsString("accnum"));
			mAlstContent.set(115, content.getAsString("sortcode"));
			mAlstContent.set(116, content.getAsString("refnum"));
		}

		String strAttchUpload1 = "/mnt/sdcard/DCMI/" + mStrMerId
				+ "-colleague1.jpg";
		File fileUpload1 = new File(strAttchUpload1);
		if (fileUpload1.exists()) {
			mAlstContent.set(118,
					"ftp://deeset\\mobileorders@81.171.198.188/mobileorders/"
							+ mStrUsername + "-" + mStrMerId
							+ "-colleague1.jpg");
		}

		String strAttchUpload2 = "/mnt/sdcard/DCMI/" + mStrMerId
				+ "-colleague2.jpg";
		File fileUpload2 = new File(strAttchUpload2);
		if (fileUpload2.exists()) {
			mAlstContent.set(119,
					"ftp://deeset\\mobileorders@81.171.198.188/mobileorders/"
							+ mStrUsername + "-" + mStrMerId
							+ "-colleague2.jpg");
		}

		String strAttchUpload3 = "/mnt/sdcard/DCMI/" + mStrMerId
				+ "-colleague3.jpg";
		File fileUpload3 = new File(strAttchUpload3);
		if (fileUpload3.exists()) {
			mAlstContent.set(120,
					"ftp://deeset\\mobileorders@81.171.198.188/mobileorders/"
							+ mStrUsername + "-" + mStrMerId
							+ "-colleague3.jpg");
		}

		String strAttchUpload4 = "/mnt/sdcard/DCMI/" + mStrMerId
				+ "-colleague4.jpg";
		File fileUpload4 = new File(strAttchUpload4);
		if (fileUpload4.exists()) {
			mAlstContent.set(121,
					"ftp://deeset\\mobileorders@81.171.198.188/mobileorders/"
							+ mStrUsername + "-" + mStrMerId
							+ "-colleague4.jpg");
		}

		String strAttchSign = "/mnt/sdcard/DCMI/" + mStrMerId
				+ "-signature.png";
		File fileSign = new File(strAttchSign);
		if (fileSign.exists()) {
			mAlstContent
					.set(122,
							"ftp://deeset\\mobileorders@81.171.198.188/mobileorders/"
									+ mStrUsername + "-" + mStrMerId
									+ "-signature.png");
		}
	}

	public String convertBoolean(String strboolean) {
		if (strboolean.equals("1")) {
			return "TRUE";
		} else {
			return "FALSE";
		}
	}

}
